import {Common} from '../components/E9/governText/text';
const common = new Common();
import {WeaLocaleProvider} from 'ecCom'
const getLabel = WeaLocaleProvider.getLabel;
export class BtnType {

    BTN_SEARCH = "1";//搜索
    BTN_ATTENTION = "2";//关注
    BTN_CHANGE = "3";//变更
    BTN_SPLIT = "4";//分解
    BTN_REPORT = "5";//反馈
    BTN_FINISH = "6";//完结
    BTN_DISCARD = "7";//废弃
    BTN_URGENT = "8";//催办
    BTN_RECEIVE = "9";//签收
    BTN_SHARECREATE = "10";//添加共享
    BTN_SHARECR = "11";//共享
    BTN_DISATTENTION = "12";//取消关注
    BTN_HAIR = "13";//下发
    BTN_BATCHHAIR = "14";//批量下发
    BTN_VIEW = "15";//查看详情
    BTN_DOCVIEW = "16";//文件预览
    BTN_EXTENSION = "17";//延期
    BTN_FINISHUP = "18";//办结
    BTN_DISCARDBATCH = "19";//批量废弃
    BTN_SHAREBATCH = "28"//批量共享
    BTN_INSTRUCT = "58"//批示
    BTN_SCHEDULEVIEW = "59"//进度视图
    BTN_EXPORT = "27"//导出Excel
    BTN_TASKDELETE = "1003"//删除任务
    BTN_TASTREOPEN = "1004"//重新开启

    /*************几个特殊的按钮  model显示 start *******************/
    BTN_SHOWREPORT = "1000";
    BTN_SHOWINSTRUCT = "1001";
    BTN_SHOWURGENT = "1002";
    BTN_SHOWULOGCHANGE = "1005";
    /*************几个特殊的按钮  model显示 end  *******************/

    /*************领导点评按钮*******************/
    BTN_CREATE = "29"; 
    BTN_EDIT = "33";
    BTN_DELETE = "31";

    /*************删除共享*******************/
    BTN_DELETEBATCH = "26";

    1 = ()=>getLabel(197,"搜索");
    2 = ()=>getLabel("25436", "关注");
    3 = ()=>getLabel("19899", "变更");
    4 = ()=>getLabel("18215", "分解");
    5 = ()=>getLabel('21950', "反馈");
    6 = ()=>getLabel("390812", "完结");
    7 = ()=>getLabel("81999", "废弃");
    8 = ()=>getLabel("23756", "催办");
    9 = ()=>getLabel("20569", "签收");
    10 = ()=>getLabel('18645', '添加共享');
    11 = ()=>getLabel(119, "共享");
    12 = ()=>getLabel("24957","取消关注");
    13 = ()=>getLabel("387965", "下发");
    14 = ()=>getLabel("20839,387965", "批量下发");
    15 = ()=>getLabel("83110", "查看详情");
    16 = ()=>getLabel("126994", "文件预览");
    17 = ()=>getLabel("2244", "延期");
    18 = ()=>getLabel("22487", "办结");
    19 = ()=>getLabel("20839,81999", "批量废弃");
    28 = ()=>getLabel("20839,119", "批量共享");
    58 = ()=>getLabel('23883,391331', "事项指导");
    27 = ()=>getLabel('17416,391383',"导出台账");
    1000 = ()=>getLabel('21950,87',"反馈信息");
    1001 = ()=>getLabel('33706,87',"批示信息");
    1002 = ()=>getLabel('23756,87',"催办信息");
    1005 = ()=>getLabel('387605',"修改详情");

    29 = ()=>getLabel('33706',"批示");
    33 = ()=>getLabel(93,"编辑");
    31 = ()=>getLabel('91',"删除");
    26 = ()=>getLabel('18646',"删除共享");

    btns = {
        "1": { key: this.BTN_SEARCH, showModel: false, showConfirm: false, refreshCard: false, refreshCardBtn: false, refreshList: false },
        "2": { key: this.BTN_ATTENTION, showModel: false, showConfirm: false, refreshCard: false, refreshCardBtn: false, refreshList: false },
        "3": { key: this.BTN_CHANGE, showModel: true, showConfirm: false, refreshCard: true, refreshCardBtn: true, refreshList: true },
        "4": { key: this.BTN_SPLIT, showModel: true, showConfirm: false, refreshCard: true, refreshCardBtn: false, refreshList: true },
        "5": { key: this.BTN_REPORT, showModel: true, showConfirm: false, showRighText: true, refreshCard: true, refreshCardBtn: false, refreshList: false },
        "6": { key: this.BTN_FINISH, showModel: false, showConfirm: true, title: ()=> getLabel(15172, "系统提示"), content: ()=>getLabel('501181',"完结当前任务会同时完结所有所属子任务，确认完结？"), refreshCard: false, refreshCardBtn: false, refreshList: true },
        "7": { key: this.BTN_DISCARD, showModel: false, showConfirm: true, title: ()=>getLabel(15172, "系统提示"), content: ()=>getLabel('501179',"废弃当前任务会同时废弃所有所属子任务，确认废弃？"), refreshCard: false, refreshCardBtn: false, refreshList: true },
        "8": { key: this.BTN_URGENT, showModel: true, showConfirm: true, showRighText: true, refreshCard: false, refreshCardBtn: false, refreshList: false },
        "9": { key: this.BTN_RECEIVE, showModel: false, showConfirm: false, refreshCard: false, refreshCardBtn: false, refreshList: true },
        "10": { key: this.BTN_SHARECREATE, showModel: false, showConfirm: false, refreshCard: false, refreshCardBtn: false, refreshList: false },
        "11": { key: this.BTN_SHARECR, showModel: false, showConfirm: false, refreshCard: false, refreshCardBtn: false, refreshList: false },
        "12": { key: this.BTN_DISATTENTION, showModel: false, showConfirm: false, refreshCard: false, refreshCardBtn: false, refreshList: false },
        "13": { key: this.BTN_HAIR, showModel: false, showConfirm: true, title: ()=>getLabel('501177',"是否要下发当前任务？"), refreshCard: false, refreshCardBtn: true, refreshList: true },
        "14": { key: this.BTN_BATCHHAIR, showModel: false, showConfirm: true, title: ()=>getLabel('501176',"是否要批量下发所有子任务？"), refreshCard: false, refreshCardBtn: true, refreshList: true },
        "15": { key: this.BTN_VIEW, showModel: false, showConfirm: false, refreshCard: false, refreshCardBtn: false, refreshList: false },
        "16": { key: this.BTN_DOCVIEW, showModel: false, showConfirm: false, refreshCard: false, refreshCardBtn: false, refreshList: false },
        "17": { key: this.BTN_EXTENSION, showModel: false, showConfirm: true, title: ()=>getLabel('501175',"确认要申请延期吗"), refreshCard: false, refreshCardBtn: false, refreshList: false },
        "18": { key: this.BTN_FINISHUP, showModel: false, showConfirm: true, title: ()=>getLabel('501174',"确认要申请办结吗"), refreshCard: false, refreshCardBtn: false, refreshList: false },
        "19": { key: this.BTN_DISCARDBATCH, showModel: false, showConfirm: true, title: ()=>getLabel('501172',"确认要废弃选中项吗"), content: ()=>getLabel('501173',"该操作会同时废弃所有子任务，确认废弃？"),refreshCard: false, refreshCardBtn: false, refreshList: true },
        "28": { key: this.BTN_SHAREBATCH, showModel: true, showConfirm: false, refreshCard: false, refreshCardBtn: false, refreshList: false },
        "58": { key: this.BTN_INSTRUCT, showModel: true, showConfirm: false, showRighText: true, refreshCard: true, refreshCardBtn: false, refreshList: false },
        "27": { key: this.BTN_EXPORT, showModel: false, showConfirm: true, title:()=>getLabel('17416,391383',"导出台账"),content:()=>getLabel('501171',"确认要导出台账吗？"), refreshCard: false, refreshCardBtn: false, refreshList: false },
		"1000": { key: this.BTN_SHOWREPORT, showRighText: true, showModel: true },
        "1001": { key: this.BTN_SHOWINSTRUCT, showRighText: true, showModel: true },
        "1002": { key: this.BTN_SHOWINSTRUCT, showRighText: true, showModel: true },
        "29": { key: this.BTN_CREATE, showRighText: true, showModel: true ,refreshList: true },
        "33": { key: this.BTN_EDIT, showRighText: true, showModel: true ,refreshList: true },
        "31": { key: this.BTN_DELETE, showModel: false, showConfirm: true, title: ()=>getLabel('501182',"确认要删除选中评论吗"), refreshCard: false, refreshCardBtn: false, refreshList: true },
        "26": { key: this.BTN_DELETEBATCH, showModel: false, showConfirm: true, title: ()=>getLabel('83601',"您确认要删除选中的记录吗？"), refreshCard: false, refreshCardBtn: false, refreshList: true },
        "1003": { key: this.BTN_TASKDELETE, showModel: false, showConfirm: true, title: ()=>getLabel('506497',"确认要删除该任务及下级任务吗？"), refreshCard: false, refreshCardBtn: false, refreshList: false },
        "1004": { key: this.BTN_TASTREOPEN, showModel: false, showConfirm: true, title: ()=>getLabel('508140',"确认要重新开启此任务及上级任务吗？"), refreshCard: false, refreshCardBtn: false, refreshList: true },
        "1005": { key: this.BTN_SHOWULOGCHANGE, showRighText: false, showModel: true },
    }

    /**
     * 是否刷新卡片页面
     */
    isRefreshCard = (modelType) => {
        let btn = this.btns[modelType] || {}
        return btn.refreshCard;
    }

    /**
     * 是否刷新卡片页面按钮
     */
    isRefreshCardBtn = (modelType) => {
        let btn = this.btns[modelType] || {}
        return btn.refreshCardBtn;
    }

    /**
     * 是否刷新列表
     */
    isRefreshList = (modelType) => {
        let btn = this.btns[modelType] || {}
        return btn.refreshList;
    }

    /**
     * 获取确认框内容
     */
    getContent = (modelType) => {
        let btn = this.btns[modelType] || {}
        return btn.content || "";
    }

    /**
     * 获取确认框标题
     */
    getTitle = (modelType) => {
        let btn = this.btns[modelType] || {}
        return btn.title;
    }

    /**
     * 获取是否刷新列表
     */
    getListRefresh = (modelType) => {
        let btn = this.btns[modelType] || {}
        return btn.refreshList;
    }
    /**
     * 校验按钮是否允许弹出确认窗口
     */
    checkShowConfirm = (modelType) => {
        let btn = this.btns[modelType] || { showConfirm: false }
        return btn.showConfirm
            || modelType === 'finishTask' || modelType === "distributeAll" || modelType === "distribute"
    }

    /**
     * 校验弹窗按钮是否显示富文本
     */
    checkShowRithtext = (modelType) => {
        let btn = this.btns[modelType] || { showRighText: false }
        return btn.showRighText
            || modelType === 'isreportLevel' || modelType === "isdisLevel" || modelType === "remindTask"
    }

    /**
     * 校验按钮是否显示弹窗
     */
    checkShowModel = (modelType) => {
        let btn = this.btns[modelType] || { showModel: false }
        return btn.showModel
            || modelType === 'issplitLevel' || modelType === 'isreportLevel' || modelType === "ischangeLevel" || modelType === "isdisLevel" || modelType === "remindTask"
    }
}
export default new BtnType